package com.jianyun.jyzs.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.jianyun.jyzs.R;
import com.jianyun.jyzs.bean.IntegratedResult;

import java.util.List;

/**
 * Created by liml on 17/5/23.
 */

public class IntegratedAdapter extends BaseAdapter{
    private List<IntegratedResult> list;
    private Context context;

    public IntegratedAdapter(List<IntegratedResult> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView==null){
            convertView = LayoutInflater.from(context).inflate(R.layout.text_view_item,null);
        }

        TextView tv = (TextView) convertView.findViewById(R.id.text_view);
        IntegratedResult result = list.get(position);
        tv.setText(result.getWebName());
        return convertView;
    }
}
